Skip to content

Honour operator precedence in SQLite REGEXP, MATCH and GLOB - #2419

Merged
iffyio merged 1 commit into
apache:mainfrom
LucaCappelletti94:sqlite-pattern-operator-precedence
Aug 4, 2026
Merged

Honour operator precedence in SQLite REGEXP, MATCH and GLOB#2419
iffyio merged 1 commit into
apache:mainfrom
LucaCappelletti94:sqlite-pattern-operator-precedence

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SQLiteDialect::parse_infix parsed the right operand of REGEXP, MATCH, and GLOB with parse_expr, and previously lead to mutating the meaning of boolean operations constructed with it.

For instance, a REGEXP 'p' AND b = 1 parsed as a REGEXP ('p' AND b = 1) instead of (a REGEXP 'p') AND (b = 1).

The hook was ignoring the precedence its caller passed, so using it fixes all three. Nothing errored before, and Display adds no parentheses, so the wrong tree reprinted as the original text. That is why a text round trip never caught it and the new test asserts on the tree instead.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review July 31, 2026 14:39

@iffyio iffyio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @LucaCappelletti94!

@iffyio
iffyio added this pull request to the merge queue Aug 4, 2026
Merged via the queue into apache:main with commit c4e7dc5 Aug 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants